package org.example;

import org.aspectj.util.IStructureModel;
import org.example.domin.School;
import org.example.domin.Student;
import org.example.service.SchoolService;
import org.example.service.StudentService;
import org.example.service.impl.StudentServiceImpl;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MyTest01 {
    @Test
    public void Test01(){
        String config="applicationContext.xml";
        ApplicationContext ctx=new ClassPathXmlApplicationContext(config);
        StudentService studentService=(StudentService) ctx.getBean("StudentService");

        Student student=new Student();
        student.setName("abc");
        student.setAge(12);
        studentService.add(student);

        studentService.get();
        studentService.doSome();

        SchoolService schoolService=(SchoolService) ctx.getBean("SchoolService");
        School school=new School();
        school.setAddress("上海");
        school.setName("上海大学");
        schoolService.add(school);

        System.out.println("");
        School school1= schoolService.get();
        System.out.println("结果："+school1.toString());
    }
}
